package cn.xorange.commons.system.mapper.system;


import cn.xorange.commons.data.core.mapper.MBaseMapper;
import cn.xorange.commons.system.entity.system.SysUserPost;
import com.alibaba.fastjson2.JSONArray;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : yangjian
 * @date : 2022/3/22
 */
@Mapper
public interface SysUserPostMapper extends MBaseMapper<SysUserPost> {

    @Select("select post_id from sys_user_post where user_id = #{userId}")
    List<Long> selectUserPostIds(@Param("userId") Long userId);

    @Delete("<script> delete  from sys_user_post where user_id in " +
    "<foreach item = 'id' collection = 'userIds' separator=',' open='(' close=')'>" +
        "#{id}" +
    "</foreach></script>")
    int delByUserIds(@Param("userIds") Long[] userIds);
}
